
package com.faithbj.device.dao.impl;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Example;
import org.springframework.stereotype.Repository;

import com.faithbj.device.dao.CostDao;
import com.faithbj.device.model.configuration.Pager;
import com.faithbj.device.model.configuration.Pager.OrderType;
import com.faithbj.device.model.entity.Cost;

/**
 * @author jrn E-mail: rinanjin@gmail.com
 * @version 0.1 
 * 创建时间：2012-5-15 上午12:58:29
 * 类说明
 */
@Repository("costDao")
public class CostDaoImpl extends BaseDaoImpl<Cost, String> implements CostDao
{
	@Override
	public Pager findByPager(Pager pager, Cost cost)
	{
		if(pager == null)
		{
			pager = new Pager();
			pager.setOrderBy("id");
			pager.setOrderType(OrderType.asc);
		}
		DetachedCriteria detachedCriteria = DetachedCriteria.forClass(Cost.class);
		detachedCriteria.add(Example.create(cost));
		return super.findByPager(pager, detachedCriteria);
	}
}
